<%--
  Created by IntelliJ IDEA.
  User: 18050
  Date: 2021/12/8
  Time: 13:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page import="java.util.List" %>
<%@ page import="com.yyyzzz.bean.Course" %>

<%@ page import="com.yyyzzz.service.courseService" %>
<%@ page import="com.yyyzzz.service.impl.courseServiceimpl" %>
<%@ page import="com.yyyzzz.DAO.impl.studentDaoimpl" %>
<%@ page import="com.yyyzzz.bean.Student" %>
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="utf-8" language="java" %>
<html>
<head>
    <title>课程信息</title>
    <link rel="stylesheet" href="studentMain/studentMain.css" type="text/css">

</head>

<div>
</div>
<body>
<header>
   <h1 style="color:red;"> ${error1}</h1>
    <a href="#" class="logo">学生选课系统</a>
    <ul>
        <li>
            <a href="#" class="active">可选课程</a>

        </li>
        <li><a href="courseServlet">已选课程</a>
        </li>
        <li><a href="updateStudentInfo.jsp">修改个人信息</a>
        </li>
        <li><a href="#"></a></li>
    </ul>
</header>
<section>
    <img src="Login/stars.png" id="stars">
    <img src="Login/moon.png" id="moon">
    <img src="Login/mountainsbehind.png" id="mountains_behind">
    <img src="Login/mountainsfront.png" id="mountains_front">
    <div class="main">
        <div class="info">

            <img src="Login/jinfu.jpg" class="jinfu">

            <table>
                <tr>
                    <td style="font-size: 1.8em;font-family: 华文楷体">个人信息</td>
                </tr>
                <%
                    studentDaoimpl studentdaoimpl = new studentDaoimpl();
                    String id = (String) session.getAttribute("id");
                    Student student = studentdaoimpl.getStudentById(id);
                %>
                <tr>
                    <td>姓名</td>
                    <td><%=student.getStuName()%>
                    </td>
                </tr>
                <tr>
                    <td>学号</td>
                    <td><%=student.getStuNo()%>
                    </td>
                </tr>
                <tr>
                    <td>班级</td>
                    <td><%=student.getStuClass()%>
                    </td>
                </tr>
                <tr>
                    <td>专业</td>
                    <td><%=student.getStuMajor()%>
                    </td>
                </tr>
                <tr>
                    <td>邮箱</td>
                    <td><%=student.getStuEmail()%>
                    </td>
                </tr>
                <tr>
                    <td>电话</td>
                    <td><%=student.getStutelphone()%>
                    </td>
                </tr>
            </table>
        </div>
        <div id="sec" class="sec">
            <div>
                <table cellspacing="0" class="tab">
                    <caption>课程信息</caption>

                    <tr>
                        <td align="center">
                            课程号
                        </td>
                        <td align="center">
                            课程名
                        </td>

                        <td align="center">
                            任课教师
                        </td>
                        <td align="center">
                            教室
                        </td>
                        <td align="center">
                            学分
                        </td>
                        <td align="center" colspan="2">
                            操作
                        </td>

                    </tr>
                    <%
                        courseService service = new courseServiceimpl();
                        List<Course> courseList = service.getAll();
                        request.setAttribute("courseList", courseList);
                        Object obj = request.getAttribute("courseList");
                        if (obj != null) {
                            List<Course> courseList1 = (List) obj;
                            for (Course course : courseList1) {
                    %>
                    <%-- <c:forEach items="${courseList1 }" var="course">--%>

                    <tr>
                        <td align="center"><%=course.getCourseId()%>
                        </td>
                        <td align="center"><%=course.getCourseName()%>
                        </td>
                        <td align="center"><%=course.getCourseTeacher()%>
                        </td>
                        <td align="center"><%=course.getClassroom()%>
                        </td>
                        <td align="center"><%=course.getCredit()%>
                        </td>
                        <td align="center" id="cao1">
                            <a style="color: #ffffff;"
                               href=" chooseCourseServlet?courseId=<%=course.getCourseId()%>&courseName=<%=course.getCourseName()%>&courseTeacher=<%=course.getCourseTeacher()%>&classRoom=<%=course.getClassroom()%>&credit=<%=course.getCredit()%>" onClick="if(!confirm('您确定退选该课程吗？'))
    return false;else return true;">选择</a>
                        </td>
                        <%--<td id="cao1" align="center">
                            <a style="color: #ff0000;" href="delectCourseServlet?courseid=<%=course.getCourseId()%>"
                               onClick="if(!confirm('您确定删除该课程吗？'))
return false;else return true;">退选</a>
                        </td>--%>
                        <%
                                }
                            }
                        %>
                    </tr>
                    <%--</c:forEach>--%>
                </table>
            </div>
        </div>
    </div>
</section>
<script>
    let stars = document.getElementById('stars');
    let moom = document.getElementById('moon');
    let mountains_behind = document.getElementById('mountains_behind');
    let mountains_front = document.getElementById('mountains_front');
    let text = document.getElementById('text');
    let btn = document.getElementById('btn');
    let header = document.querySelector('header');
    window.addEventListener('scroll', function () {
        let value = window.scrollY;
        stars.style.left = value * 0.25 + 'px';
        moom.style.top = value * 1.05 + 'px';
        mountains_behind.style.top = value * 0.5 + 'px';
        mountains_front.style.top = value * 0 + 'px';
        text.style.marginRight = value * 4 + 'px';
        text.style.marginTop = value * 1.5 + 'px';
        btn.style.marginRight = value * 4 + 'px';
        header.style.top = value * 0.5 + 'px';

    })

    function bc() {
        document.getElementById("search").style.width = '600px';
    }

    function lk() {
        document.getElementById("search").style.width = '200px';
    }
</script>


</body>
</html>
